package patterns.nullobject;

/**
 * Created by lenovo on 2016/12/9 0009.
 * Customer的工厂类
 */
public class CustomerFactory {
    public static  final String[] names = {"Joe","John","Robert"};

    public static AbstractCustomer getCustomer(String name){
        for (int i =0;i<names.length;i++){
            if (names[i].equalsIgnoreCase(name)){
                return new RealCustomer(name);
            }
        }
        return new NullCustomer();
    }
}
